package com.jiuqi.common.util;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: </p>
 * @author unascribed
 * @version 1.0
 */

public class OrderGenerator {
  private static long oldOrder = 0;
  private static Object o = new Object();
  private static final String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  public static String newOrder(){
    synchronized(o){
      long order = System.currentTimeMillis();
      while(order<=oldOrder){
        order++;
      }
      oldOrder =order;
      StringBuffer rt = new StringBuffer(10);
      while(order>0){
        rt.insert(0, chars.charAt((int)(order%36)));
        order = order/36;
      }
      return rt.toString();
    }
  }
  
  public static void main(String[] args){
    for(int i=0; i<100; i++)
    System.out.println(OrderGenerator.newOrder());
  }
}
